﻿<view:SelectedCardBase x:Class="Conqueror.WP.View.SelectedGameCard"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:view="clr-namespace:Conqueror.WP.View"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480">
    
    <Grid x:Name="LayoutRoot" Tap="OpenGameAction">
        <Grid.Background>
            <ImageBrush ImageSource="{Binding MapImage}" Stretch="UniformToFill">
                <ImageBrush.RelativeTransform>
                    <CompositeTransform CenterY="0.5" CenterX="0.5"/>
                </ImageBrush.RelativeTransform>
            </ImageBrush>
        </Grid.Background>

        <Grid  Margin="0,12,12,0" VerticalAlignment="Top">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Rectangle Fill="#C8000000"/>
            <TextBlock Text="{Binding MapName}" FontSize="{StaticResource PhoneFontSizeLarge}"
                       Margin="12,6,0,6" Foreground="White"/>
            <Border HorizontalAlignment="Right" MinWidth="6"
                    Background="{Binding CurrentPlayerBrush}">
                <Image Source="/Image/Icons/appbar.lock.png" Stretch="Uniform"
                       Visibility="{Binding PrivateGame}" Width="48"/>
            </Border>
            
            <Rectangle Fill="#A8000000" Opacity="0.67"
                       Grid.Row="1"/>
            <StackPanel Orientation="Vertical" Grid.Row="1" Margin="12,6,0,6">
                <TextBlock Text="{Binding GameMode}"
                           Foreground="White" FontSize="{StaticResource PhoneFontSizeMedium}"/>
                <TextBlock Text="{Binding Reinforcements}"
                           Foreground="White" FontSize="{StaticResource PhoneFontSizeMedium}"/>
                <TextBlock Text="{Binding Spoils}"
                           Foreground="White" FontSize="{StaticResource PhoneFontSizeMedium}"/>
            </StackPanel>
        </Grid>

        <Grid Background="#C8000000" Margin="12,0,0,12"
                VerticalAlignment="Bottom">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="96"/>
                <ColumnDefinition Width="6"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            
            <TextBlock Text="{Binding TimeString}" FontSize="{StaticResource PhoneFontSizeSmall}"
                       Margin="12,6,0,6" Foreground="White"/>

            <ScrollViewer Grid.Column="2" VerticalScrollBarVisibility="Disabled"
                          HorizontalScrollBarVisibility="Hidden">
                <ItemsControl ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                              ScrollViewer.VerticalScrollBarVisibility="Disabled"
                              ItemsSource="{Binding Players}" Margin="0,0,12,0">
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel Orientation="Horizontal"/>
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>

                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding PlayerName}" FontSize="{StaticResource PhoneFontSizeSmall}"
                       Margin="12,6,0,6" Foreground="{Binding PlayerBrush}"/>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </ScrollViewer>

            <Rectangle Width="6" HorizontalAlignment="Left"
                       Fill="{Binding CurrentPlayerBrush}" Grid.Column="1"/>
            
        </Grid>

        <Grid x:Name="tapToPlay">
            <view:TapToOpenGame/>
        </Grid>
    </Grid>
</view:SelectedCardBase>